const fs = require('fs')//引入

let s = fs.readFileSync('persons.json').toString();//本来是二进制然后转成字符串
let n = JSON.parse(s)//字符串转对象
console.log(n);

let user = { username:"admin1",password:"12345" }
//登录
var v = n.find(item => user.username === item.username && user.password === item.password)
if (v) {
    console.log('登录成功');
} else {
    console.log('用户名和密码错误');
}
